<?php

/**
 *
 *
 * @version $Id$
 * @copyright 2011
 */

/**
 *
 *
 */
class ExcActiveRecord extends CActiveRecord {
	/**
	 * Extends setAttributes to handle active date fields
	 *
	 * @param $values
	 * @param $scenario
	 */
	public function setAttributes ($values)
	{
		foreach ($this->dateAttributes() as $dateAttribute)
		{
			if (is_array($values[$dateAttribute]))
			{
				$day = $values[$dateAttribute]['day'];
				$month = $values[$dateAttribute]['month'];
				$year = $values[$dateAttribute]['year'];

				$values[$dateAttribute] = date('Y-m-d',mktime(0,0,0,$month,$day,$year));
			}
		}

		parent::setAttributes($values);
	}
}
?>